package com.ikun.service.impl;

import com.ikun.mapper.TbUserTaskMapper;
import com.ikun.pojo.TbUserTask;
import com.ikun.service.UserTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserTaskServiceImpl implements UserTaskService {

    @Autowired
    TbUserTaskMapper userTaskMapper;

    @Override
    public List<TbUserTask> selMyFinish(int userid, int page) {
        int pg = (page-1)*8;
        List<TbUserTask> utList = userTaskMapper.selMyFinish(userid,pg);
        return utList;
    }

    @Override
    public int selMyFinishCount(int userid) {
        int count = userTaskMapper.selMyFinishCount(userid);
        if (count <= 8){
            count = 1;
        }else{
            if (count%8 == 0){
                count = count/8;
            }else{
                count = count/8+1;
            }
        }
        return count;
    }
}
